package 题目集.位运算.集合论;

/**
 * https://leetcode.cn/problems/smallest-number-with-all-set-bits/description/
 * 题意：给你一个数k，找出二进制全是1，且>=k的最小整数
 */
public class ch01_全是1的最小整数 {
    public int smallestNumber(int n) {
        int v=1;
        while((v|n)!=v){
            v=v<<1|1;
        }
        return v;
    }
}
